<?php
/**
 * Created by PhpStorm.
 * User: Xwen
 * Date: 2018/12/10
 * Time: 21:43
 *
 *          ┌─┐       ┌─┐
 *       ┌──┘ ┴───────┘ ┴──┐
 *       │                 │
 *       │       ───       │
 *       │  ─┬┘       └┬─  │
 *       │                 │
 *       │       ─┴─       │
 *       │                 │
 *       └───┐         ┌───┘
 *           │         │
 *           │         │
 *           │         │
 *           │         └──────────────┐
 *           │                        │
 *           │                        ├─┐
 *           │                        ┌─┘
 *           │                        │
 *           └─┐  ┐  ┌───────┬──┐  ┌──┘
 *             │ ─┤ ─┤       │ ─┤ ─┤
 *             └──┴──┘       └──┴──┘
 *                 神兽保佑
 *                 代码无BUG!
 *"The trouble with programmers is that you can never tell what a programmer is doing until it’s too late.”- Seymour Cray
 */

namespace app\admin\controller;


use think\App;
use think\Controller;

class Base extends Controller
{
    public function __construct(App $app = null)
    {
        parent::__construct($app);
        if(!model('Login', 'logic')->loginCheck()){
            $this->error('你还没有登录，请登录后再访问！', '/admin-login');
        }
        $controller = $this->request->controller();
        $method = $this->request->action();
        if(!model('Access', 'logic')->accessCheck($controller, $method)){
            $this->error('你没有权限，请获得权限后再访问！', '/');
        }

    }


}